.MODEL small;
.DATA;

msj_error1 db 'Overflow en suma$';
msj_error2 db 'Division por cero$';
errorIndiceFueraDeRango db 'Indice fuera de rango$';
_4 dd 4;
_i dd ? ;
_5 dd 5 ;
_10 dd 10 ;
salida db 0;	

_enif db 'enif$';
_enelse db 'enelse$';
.CODE;
.386P;

errorOverflowSuma:	
MOV DX, OFFSET msj_error1;
MOV AH, 09H;
INT 21H;
MOV AH,4CH;
MOV AL,1H;
INT 21H;
MOV salida, 1;
JMP finalize;

errorDivisionPorCero:	
MOV DX, OFFSET msj_error2;
MOV AH, 09H;
INT 21H;
MOV AH,4CH;
MOV AL,1H;
INT 21H;
MOV salida, 2;
JMP finalize;

IndiceFueraDeRango: 
MOV DX, OFFSET errorIndiceFueraDeRango;
MOV AH, 09H;
INT 21H;
MOV AH,4CH;
MOV AL,1H;
INT 21H;
MOV salida, 2;
JMP finalize;

start:	;
  MOV AX, @data;	(start)
  MOV DS, AX;	        (start)
  MOV EAX, _5;		terceto 0
  MOV _i, EAX;		terceto 0
  MOV EAX, _10;		terceto 1
  CMP EAX, _i;		terceto 1
  JG LAB5;		terceto 2
  MOV EAX, OFFSET _enif;		terceto 3
  MOV AH, 09H ;		terceto 3
  INT 21H;		terceto 3
  JMP IndiceFueraDeRango;		terceto 4
LAB5: 
  MOV EAX, OFFSET _enelse;		terceto 5
  MOV AH, 09H ;		terceto 5
  INT 21H;		terceto 5
  JMP finalize;	(finalizar programa)

finalize:	
  MOV AL, salida;
  MOV AH, 4CH;
  INT 21H;
END start	;